

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>activate &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/doctools.js"></script>
        <script src="../../../_static/sphinx_highlight.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" />
    <link rel="next" title="batch" href="../batch/" />
    <link rel="prev" title="lvm" href="../" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../../" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="../../">ceph-volume</a></li>
      <li class="breadcrumb-item active"><code class="docutils literal notranslate"><span class="pre">activate</span></code></li>
      <li class="wy-breadcrumbs-aside">
            <a href="../../../_sources/ceph-volume/lvm/activate.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../" class="icon icon-home"> Ceph
          

          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../start/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../monitoring/">监控概览</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../">ceph-volume</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="../../#id2">迁移</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../../#id3">全新部署</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="../../#osd">已有 OSD 怎么办</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="../../intro/">Overview</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../intro/#replacing-ceph-disk">Replacing <code class="docutils literal notranslate"><span class="pre">ceph-disk</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../intro/#gpt-partitions-are-simple">GPT partitions are simple?</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../intro/#modularity">Modularity</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../intro/#ceph-volume-lvm"><code class="docutils literal notranslate"><span class="pre">ceph-volume</span> <span class="pre">lvm</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../intro/#lvm-performance-penalty">LVM performance penalty</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../systemd/">systemd</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../inventory/"><code class="docutils literal notranslate"><span class="pre">inventory</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../drive-group/"><code class="docutils literal notranslate"><span class="pre">drive-group</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../"><code class="docutils literal notranslate"><span class="pre">lvm</span></code></a></li>
<li class="toctree-l4 current"><a class="current reference internal" href="#"><code class="docutils literal notranslate"><span class="pre">activate</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../batch/"><code class="docutils literal notranslate"><span class="pre">batch</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../batch/#ceph-volume-lvm-batch-report">报表</a></li>
<li class="toctree-l4"><a class="reference internal" href="../batch/#sizing">Sizing</a></li>
<li class="toctree-l4"><a class="reference internal" href="../batch/#idempotency-and-disk-replacements">Idempotency and disk replacements</a></li>
<li class="toctree-l4"><a class="reference internal" href="../encryption/">加密</a></li>
<li class="toctree-l4"><a class="reference internal" href="../prepare/"><code class="docutils literal notranslate"><span class="pre">prepare</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../create/"><code class="docutils literal notranslate"><span class="pre">create</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../scan/">scan</a></li>
<li class="toctree-l4"><a class="reference internal" href="../systemd/">systemd</a></li>
<li class="toctree-l4"><a class="reference internal" href="../list/"><code class="docutils literal notranslate"><span class="pre">list</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../zap/"><code class="docutils literal notranslate"><span class="pre">zap</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../migrate/"><code class="docutils literal notranslate"><span class="pre">migrate</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../newdb/"><code class="docutils literal notranslate"><span class="pre">new-db</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../newwal/"><code class="docutils literal notranslate"><span class="pre">new-wal</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../simple/"><code class="docutils literal notranslate"><span class="pre">simple</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../simple/activate/"><code class="docutils literal notranslate"><span class="pre">activate</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../simple/scan/"><code class="docutils literal notranslate"><span class="pre">scan</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../simple/systemd/">systemd</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../zfs/"><code class="docutils literal notranslate"><span class="pre">zfs</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../zfs/inventory/"><code class="docutils literal notranslate"><span class="pre">inventory</span></code></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../hardware-monitoring/">硬件监控</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <section id="activate">
<span id="ceph-volume-lvm-activate"></span><h1><code class="docutils literal notranslate"><span class="pre">activate</span></code><a class="headerlink" href="#activate" title="Permalink to this heading"></a></h1>
<p>After <a class="reference internal" href="../prepare/#ceph-volume-lvm-prepare"><span class="std std-ref">prepare</span></a> has completed its run, the volume can be
activated.</p>
<p>Activating the volume involves enabling a <code class="docutils literal notranslate"><span class="pre">systemd</span></code> unit that persists the
<code class="docutils literal notranslate"><span class="pre">OSD</span> <span class="pre">ID</span></code> and its <code class="docutils literal notranslate"><span class="pre">UUID</span></code> (which is also called the <code class="docutils literal notranslate"><span class="pre">fsid</span></code> in the Ceph CLI
tools). After this information has been persisted, the cluster can determine
which OSD is enabled and must be mounted.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The execution of this call is fully idempotent. This means that the
call can be executed multiple times without changing the result of its first
successful execution.</p>
</div>
<p>For information about OSDs deployed by cephadm, refer to
<a class="reference internal" href="../../../cephadm/services/osd/#cephadm-osd-activate"><span class="std std-ref">Activate existing OSDs</span></a>.</p>
<section id="osd">
<h2>新 OSD<a class="headerlink" href="#osd" title="Permalink to this heading"></a></h2>
<p>To activate newly prepared OSDs both the <a class="reference internal" href="../../../glossary/#term-OSD-ID"><span class="xref std std-term">OSD id</span></a> and <a class="reference internal" href="../../../glossary/#term-OSD-UUID"><span class="xref std std-term">OSD uuid</span></a>
need to be supplied. For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span><span class="o">-</span><span class="n">volume</span> <span class="n">lvm</span> <span class="n">activate</span> <span class="o">--</span><span class="n">bluestore</span> <span class="mi">0</span> <span class="mi">0263644</span><span class="n">D</span><span class="o">-</span><span class="mi">0</span><span class="n">BF1</span><span class="o">-</span><span class="mi">4</span><span class="n">D6D</span><span class="o">-</span><span class="n">BC34</span><span class="o">-</span><span class="mi">28</span><span class="n">BD98AE3BC8</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>这个 UUID 存储于 OSD 路径下的 <code class="docutils literal notranslate"><span class="pre">fsid</span></code> 文件内，它是在调用 <a class="reference internal" href="../prepare/#ceph-volume-lvm-prepare"><span class="std std-ref">prepare</span></a> 时生成的。</p>
</div>
</section>
<section id="id1">
<h2>激活所有 OSD<a class="headerlink" href="#id1" title="Permalink to this heading"></a></h2>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>For OSDs deployed by cephadm, please refer to :ref:cephadm-osd-activate:
instead.</p>
</div>
<p>It is possible to activate all existing OSDs at once by using the <code class="docutils literal notranslate"><span class="pre">--all</span></code>
flag. For example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ceph</span><span class="o">-</span><span class="n">volume</span> <span class="n">lvm</span> <span class="n">activate</span> <span class="o">--</span><span class="nb">all</span>
</pre></div>
</div>
<p>This call will inspect all the OSDs created by ceph-volume that are inactive
and will activate them one by one. If any of the OSDs are already running, it
will report them in the command output and skip them, making it safe to rerun
(idempotent).</p>
<section id="uuid">
<h3>必备 uuid<a class="headerlink" href="#uuid" title="Permalink to this heading"></a></h3>
<p>The <a class="reference internal" href="../../../glossary/#term-OSD-UUID"><span class="xref std std-term">OSD uuid</span></a> is being required as an extra step to ensure that the
right OSD is being activated. It is entirely possible that a previous OSD with
the same id exists and would end up activating the incorrect one.</p>
</section>
<section id="dmcrypt">
<h3>dmcrypt<a class="headerlink" href="#dmcrypt" title="Permalink to this heading"></a></h3>
<p>If the OSD was prepared with dmcrypt by ceph-volume, there is no need to
specify <code class="docutils literal notranslate"><span class="pre">--dmcrypt</span></code> on the command line again (that flag is not available for
the <code class="docutils literal notranslate"><span class="pre">activate</span></code> subcommand). An encrypted OSD will be automatically detected.</p>
</section>
</section>
<section id="id2">
<h2>发现<a class="headerlink" href="#id2" title="Permalink to this heading"></a></h2>
<p>With OSDs previously created by <code class="docutils literal notranslate"><span class="pre">ceph-volume</span></code>, a <em>discovery</em> process is
performed using <a class="reference internal" href="../../../glossary/#term-LVM-tags"><span class="xref std std-term">LVM tags</span></a> to enable the systemd units.</p>
<p>The systemd unit will capture the <a class="reference internal" href="../../../glossary/#term-OSD-ID"><span class="xref std std-term">OSD id</span></a> and <a class="reference internal" href="../../../glossary/#term-OSD-UUID"><span class="xref std std-term">OSD uuid</span></a> and
persist it. Internally, the activation will enable it like:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>systemctl enable ceph-volume@lvm-$id-$uuid
</pre></div>
</div>
<p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">systemctl</span> <span class="n">enable</span> <span class="n">ceph</span><span class="o">-</span><span class="n">volume</span><span class="nd">@lvm</span><span class="o">-</span><span class="mi">0</span><span class="o">-</span><span class="mi">8715</span><span class="n">BEB4</span><span class="o">-</span><span class="mi">15</span><span class="n">C5</span><span class="o">-</span><span class="mi">49</span><span class="n">DE</span><span class="o">-</span><span class="n">BA6F</span><span class="o">-</span><span class="mi">401086</span><span class="n">EC7B41</span>
</pre></div>
</div>
<p>Would start the discovery process for the OSD with an id of <code class="docutils literal notranslate"><span class="pre">0</span></code> and a UUID of
<code class="docutils literal notranslate"><span class="pre">8715BEB4-15C5-49DE-BA6F-401086EC7B41</span></code>.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>for more details on the systemd workflow see <a class="reference internal" href="../systemd/#ceph-volume-lvm-systemd"><span class="std std-ref">systemd</span></a></p>
</div>
<p>The systemd unit will look for the matching OSD device, and by looking at its
<a class="reference internal" href="../../../glossary/#term-LVM-tags"><span class="xref std std-term">LVM tags</span></a> will proceed to:</p>
<p>#. Mount the device in the corresponding location (by convention this is
<code class="docutils literal notranslate"><span class="pre">/var/lib/ceph/osd/&lt;cluster</span> <span class="pre">name&gt;-&lt;osd</span> <span class="pre">id&gt;/</span></code>)</p>
<ol class="arabic simple">
<li><p>Ensure that all required devices are ready for that OSD.</p></li>
<li><p>Start the <code class="docutils literal notranslate"><span class="pre">ceph-osd&#64;0</span></code> systemd unit</p></li>
</ol>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The system infers the objectstore type by
inspecting the LVM tags applied to the OSD devices</p>
</div>
</section>
<section id="id3">
<h2>对于已有 OSD<a class="headerlink" href="#id3" title="Permalink to this heading"></a></h2>
<p>对于之前已经用 <code class="docutils literal notranslate"><span class="pre">ceph-disk</span></code> 部署的各 OSD ，需要<a class="reference internal" href="../../simple/#ceph-volume-simple"><span class="std std-ref">用 simple 子命令</span></a>扫描并激活。如果用的是其它的工具链，把它们移植到新机制唯一的方法是再准备一次（会丢数据）。如何操作见 <a class="reference internal" href="../prepare/#ceph-volume-lvm-existing-osds"><span class="std std-ref">对于已有 OSD</span></a> 。</p>
</section>
<section id="id4">
<h2>总结<a class="headerlink" href="#id4" title="Permalink to this heading"></a></h2>
<p>To recap the <code class="docutils literal notranslate"><span class="pre">activate</span></code> process for <a class="reference internal" href="../../../glossary/#term-BlueStore"><span class="xref std std-term">bluestore</span></a>:</p>
<ol class="arabic simple">
<li><p>Require both <a class="reference internal" href="../../../glossary/#term-OSD-ID"><span class="xref std std-term">OSD id</span></a> and <a class="reference internal" href="../../../glossary/#term-OSD-UUID"><span class="xref std std-term">OSD uuid</span></a></p></li>
<li><p>Enable the system unit with matching id and uuid</p></li>
<li><p>Create the <code class="docutils literal notranslate"><span class="pre">tmpfs</span></code> mount at the OSD directory in
<code class="docutils literal notranslate"><span class="pre">/var/lib/ceph/osd/$cluster-$id/</span></code></p></li>
<li><p>Recreate all the files needed with <code class="docutils literal notranslate"><span class="pre">ceph-bluestore-tool</span> <span class="pre">prime-osd-dir</span></code> by
pointing it to the OSD <code class="docutils literal notranslate"><span class="pre">block</span></code> device.</p></li>
<li><p>The systemd unit will ensure all devices are ready and linked</p></li>
<li><p>The matching <code class="docutils literal notranslate"><span class="pre">ceph-osd</span></code> systemd unit will get started</p></li>
</ol>
</section>
</section>



<div id="support-the-ceph-foundation" class="admonition note">
  <p class="first admonition-title">Brought to you by the Ceph Foundation</p>
  <p class="last">The Ceph Documentation is a community resource funded and hosted by the non-profit <a href="https://ceph.io/en/foundation/">Ceph Foundation</a>. If you would like to support this and our other efforts, please consider <a href="https://ceph.io/en/foundation/join/">joining now</a>.</p>
</div>


           </div>
           
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="../" class="btn btn-neutral float-left" title="lvm" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="../batch/" class="btn btn-neutral float-right" title="batch" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).</p>
  </div>

   

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>